
<link rel="stylesheet" href="/styles/thickbox.css" />
<script type="text/javascript" src="/scripts/thickbox.js"></script>
<link type="text/css" rel="stylesheet" href="/styles/jquery.capty.css"/>
		<script type="text/javascript" src="/scripts/jquery.capty.min.js"></script>
<div id="blockContIn">
<table border="0" cellspacing="0" cellpadding="0" align="left">
  <tr>
    <td valign="top"><div class="Col">
	<tal:block tal:content="structure php: this.partial('index/myactivityview.html')"/>
</div></td>
	<td valign="top" width="100%"><div class="ColTrg">
<div class="ModuleBlock" style="height:850px">
<h1>
<label>Photos</label>
<div><a href="/album/settings/album-settings"  ><img src="/images/SettingsIcon.png" border="0" alt="Settings" title="Settings" align="top" class="SetIcon"/></a>
<a href="/album/photos/all"><img src="/images/HomeIcon.png" alt="Home" width="15" height="17"  border="0"  align="top" class="SetIcon" title="Home"/></a>
<a id="create" href="javascript:void(0);" onclick="createAlbum();"><img src="/images/CreateAddIcon.png" alt="Create" width="15" height="15"  border="0"  align="top" class="SetIcon" title="Create"/></a>


</div>
</h1>
<?php if(count($ctx->photoview['result'])!=0)
{ ?>
<div class="pad_a">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td valign="top">
	<div class="pad_a">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td valign="top">
	<div>
	<div>
    <div class="pad_t8">
	<div class="Fleft">
	<div id="topPagerId" class="paginat"></div>
	</div>
    <div class="Fright">
	<a class="BtGray" id="Check_All" name="Check_All" href="javascript:void(0);" onClick="CheckAll(document.getElementsByName('check_list[]'))">Check All</a>
	<a class="BtGray" id="Check_All" name="Check_All" href="javascript:void(0);" onClick="uncheckAll(document.getElementsByName('check_list[]'))">Uncheck All</a>
	<?php 
	if($ctx->photoview['result'][0]['PhotoRelations'][0]['is_owner']==1)
	{ ?>
	<a class="BtGray" href="javascript:void(0);" onclick="addPhotosToAlbum('');">Add to album</a>
    <a id="create" class="BtGray" href="javascript:void(0);" onclick="addPhotos();">Add photos</a>
    <a class="BtGray" href="javascript:void(0);" onclick="sharePhotos('');">Share Photos</a>
	<? } ?>
    <a class="BtGray" href="javascript:void(0);" onclick="deleteSelectedPhotos('');">Delete</a>
    </div>
     <div class="clear"></div>
    </div>
	<div id="listContent">
	<?php 
	if($ctx->photoview['result'][0]['PhotoRelations'][0]['is_owner']==1)
	{
			$type="photo_id";
	}
	else
	{
			$type="relation_id";
	}
//echo $user_id.'--'.$favorite_status;exit;
 ?>
 
	<tal:block tal:content="structure php: this.partial('/photos/photo-view-list.html')"/>
	
	</div>
	
<div class="clear"></div>     
   <div class="Fleft">
	<div id="downPagerId" class="paginat"></div>
    </div>
    <div class="clear"></div>
    </div>
	
	</div>
	</td>
  </tr>
</table>
</div>
	
	</td>
  </tr>
</table>
</div>
<? } else { ?>
	<p style="padding:50px 50px"><h3><b><center>No Photos click <a href="/album/photos/all"><img src="/images/HomeIcon.png" alt="Home" width="15" height="17"  border="0"  align="top" class="SetIcon" title="Home"/></a>
</center></b></h3></p>
		
	<? } ?>

<div class="clear"></div>
 <div id="downPagerId" class="paginat" style="padding-right:15px;"></div>
 <div class="clear"></div>
<div class="clear"></div>
</div>
</div></td>
<td valign="top">
<div class="ColBanner">
<div class="ModuleBlock">
<img src="/images/Gads.gif" /><img src="/images/Gads.gif" /></div>
</div></td>	
  </tr>
</table>
</div>
<script type="text/javascript">
//<![CDATA[
	pagination = new Array();
	pagination['currentPage'] = "<?=$ctx->photoview['currentPage']?>";
	pagination['resultsPerPage'] = "<?=$ctx->photoview['resultPerPage']?>";
	pagination['pages'] = "<?= $ctx->photoview['pages']?>";  
	pagination['pager'] = '<?=$ctx->photoview["pager"]?>';
	pagination['resultsCount'] = "${photoview/resultsCount}" ;
	
	var Params='${params}';
	//alert(pagination['resultsCount']+'  '+Params);
		var photo_diffid='<?php echo $ctx->photo_diffid; ?>';
	var requestUrl = "/album/photos/paginationphotos/<?php echo $ctx->type; ?>/";
	$(document).ready(function () {
				
	   setPagination(pagination['resultsCount'],'topPagerId','downPagerId','','');
	});
	
function createAlbum()
{
	tb_show('Upload Photos','/album/index/create-album?&add=add&height=400&width=600','');
}
function addPhotos()
{
	tb_show('Upload Photos','/album/photos/add-photos?&photo_diffid='+<?php echo $ctx->photo_diffid; ?>+'&type='+<?php echo $ctx->type; ?>+'&add=add&height=400&width=600','');
}
function sharePhotos(ind)
{
	if(ind=='') {
		var val = '';
		$('#check_list:checked').each(function(i){
		  val+= $(this).val()+',';
		});
		if(val == '')
		{
			alert('Please select a photo');
			return false;
		}
	} else {
		val = ind;
	}
	//alert(val);return false;
	tb_show('share Photos','/album/photos/share-photos?&photos='+val+'&photo_diffid='+<?php echo $ctx->photo_diffid; ?>+'&type='+<?php echo $ctx->type; ?>+'&height=250&width=600','');
}
function addPhotosToAlbum(ind)
{
	//alert(ind);return false;
	if(ind=='') {
		var val = '';
		$('#check_list:checked').each(function(i){
		  val+= $(this).val()+',';
		});
		if(val == '')
		{
			alert('Please select a photo');
			return false;
		}
	} else {
		val = ind;
	}
	//alert(val);return false;
	tb_show('Add Photos To album','/album/photos/addto-album?&photos='+val+'&photo_diffid='+<?php echo $ctx->photo_diffid; ?>+'&type='+<?php echo $ctx->type; ?>+'&height=400&width=600','');
}
function changeStatusFavorite(photo_id,status)
{
	//alert(album_id+"and"+status);return false;
		$.ajax({
			   
			    type: "POST",
				dataType: "json",
			    data: "photo_id="+photo_id+"&status="+status+"&type1=photos&type="+<?php echo $ctx->type; ?>+"&photo_diffid="+<?php echo $ctx->photo_diffid; ?>,
			    url: "/album/photos/favorites/",
			    success: function(data){
					$('#listContent').html(data.output);						
				}
			});
}
function deleteSelectedPhotos(ind)
{
	
	if(ind=='') {
		var val = '';
		$('#check_list:checked').each(function(i){
		  val+= $(this).val()+',';
		});
		if(val == '')
		{
			alert('Please select a photo');
			return false;
		}
	} else {
		val = ind;
	}
	//alert(val);return false;
	if(confirm('Do you really want to delete ?'))
	{
	$.ajax({
			   
			    type: "POST",
				dataType: "json",
			    data: "photo_id="+val+"&delete_type="+'<?php echo $type;?>'+"&type="+<?php echo $ctx->type; ?>+"&photo_diffid="+<?php echo $ctx->photo_diffid; ?>,
			    url: "/album/photos/delete-selected-photo/",
			    success: function(data){
					$('#listContent').html(data.output);					
				}
			});
		}	
	else {
		return false;
	}		
}
function CheckAll(chk)
{
		var ids="";
		for (i = 0; i < chk.length; i++){
		chk[i].checked = true ;
		}
}
function uncheckAll(chk)
{
		var ids="";
		for (i = 0; i < chk.length; i++){
		chk[i].checked = false ;
		}
}

function deletePhoto(val)
{
	//alert(val);return false;
	if(confirm('Do you really want to delete ?'))
	{
	 $.ajax({
			   
			    type: "POST",
				dataType: "json",
			    data: "photo_id="+val+"&delete_type="+'<?php echo $type;?>'+"&type="+<?php echo $ctx->type; ?>+"&photo_diffid="+<?php echo $ctx->photo_diffid; ?>,
			    url: "/album/photos/delete-selected-photo/",
			    success: function(data){
					$('#listContent').html(data.output);					
				}
			});					
			}	
	else {
		return false;
	}	

}

//]]>

</script>
<!-- Image Overlay  -->
		
<!-- Image Overlay End -->